package com.tengju.motivation.infrastructure.persistence.mybatis.mapper;

import com.tengju.motivation.infrastructure.persistence.mybatis.dataobject.PerformanceObjectiveDO;
import com.tengju.motivation.infrastructure.persistence.mybatis.dataobject.PerformanceObjectiveTotalDO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MotivationPerformanceObjectiveMapper {

    List<PerformanceObjectiveDO> selectByObjectIdsAndType(
            @Param("objectIds") List<Long> objectIds,
            @Param("type") Integer type,
            @Param("startTime") Integer startTime,
            @Param("endTime") Integer endTime);

    List<PerformanceObjectiveDO> selectByObjectIdAndKeysAndType(
            @Param("objectId") Long objectId,
            @Param("keys") List<String> keys,
            @Param("userTypeCode") Integer userTypeCode,
            @Param("startTime") Integer startTime,
            @Param("endTime") Integer endTime);

    int batchInsert(@Param("performanceObjectiveDOList") List<PerformanceObjectiveDO> performanceObjectiveDOList);

    int deleteByIds(@Param("ids") List<Long> ids);

    int deleteByTime(@Param("type") Integer performanceObjectiveType,
                    @Param("startTime") Integer startTime,
                    @Param("endTime") Integer endTime);

    int deleteForChunMiaoByObjectIdAndKeys(@Param("objectId") Long objectId, @Param("keys")  List<String> keys,
                                           @Param("userTypeCode") Integer userTypeCode,
                                           @Param("startTime") Integer startTime, @Param("endTime") Integer endTime);


    int getCommonListTotal(@Param("startTime") Integer startTime,
                           @Param("endTime") Integer endTime,
                           @Param("chiefId") Long chiefId,
                           @Param("type") Integer performanceObjectiveType,
                           @Param("objectId") Long performanceObjectiveObjectId);

    List<Long> getObjectIdList(@Param("startTime") Integer startTime,
                               @Param("endTime") Integer endTime,
                               @Param("chiefId") Long chiefId,
                               @Param("type") Integer performanceObjectiveType,
                               @Param("objectId") Long performanceObjectiveObjectId,
                               @Param("offset") Integer offset,
                               @Param("limit") Integer limit);

    int getActivityListTotal(@Param("relationId") Long activityId,
                             @Param("chiefId") Long chiefId,
                             @Param("type") Integer performanceObjectiveType,
                             @Param("objectId") Long performanceObjectiveObjectId);

    List<Long> getRelationObjectIdList(@Param("relationId") Long activityId,
                                       @Param("chiefId") Long chiefId,
                                       @Param("type") Integer performanceObjectiveType,
                                       @Param("objectId") Long performanceObjectiveObjectId,
                                       @Param("offset") Integer offset,
                                       @Param("limit") Integer limit);

    List<PerformanceObjectiveTotalDO> getPerformanceObjectiveTotalByRelationId(@Param("relationId") Long activityId);

    int deleteByRelationId(@Param("relationId") Long relationId);

    int getListTotal(@Param("startTime") Integer startTime,
                     @Param("endTime") Integer endTime,
                     @Param("chiefId") Long chiefId,
                     @Param("type") Integer performanceObjectiveType,
                     @Param("objectId") Long performanceObjectiveObjectId);

    int updateByRelationId(@Param("relationId") Long relationId,
                           @Param("startTime") Integer startTime,
                           @Param("endTime") Integer endTime);
}
